<template>
  <view class="favorites-container">
    <text class="favorites-title">我的收藏</text>
    <view class="favorite-item" v-for="(favorite, index) in favoriteAttractions" :key="index">
      <image class="favorite-image" :src="favorite.image" mode="aspectFill"></image>
      <text class="favorite-title">{{ favorite.title }}</text>
      <text class="favorite-description">{{ favorite.description }}</text>
    </view>
  </view>
</template>

<script>
export default {
  data() {
    return {
      favoriteAttractions: []
    };
  },
  onLoad(options) {
    // 获取上一个页面传递过来的收藏数据（如果有通过传参方式传递的话）
    const favoriteData = options.favoriteData;
    if (favoriteData) {
      this.favoriteAttractions = JSON.parse(favoriteData);
    }
  }
};
</script>

<style lang="scss">
.favorites-container {
  max-width: 1000px;
  margin: 40px auto;
  padding: 30px;
  background-color: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
  color: #333;
  font-family: Arial, sans-serif;
}

.favorites-title {
  text-align: center;
  color: #5e35b1;
  font-size: 2.5em;
  margin-bottom: 30px;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.favorite-item {
  background-color: #f7f7f7;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease-in-out;
  cursor: pointer;
  margin-bottom: 20px;
  position: relative;
}

.favorite-item:hover {
  transform: translateY(-5px);
}

.favorite-image {
  width: 100%;
  height: 150px;
}

.favorite-title {
  color: #333;
  font-size: 1.2em;
  margin: 15px 15px 10px;
  text-align: center;
  font-weight: bold;
}

.favorite-description {
  color: #666;
  font-size: 0.9em;
  padding: 0 15px 15px;
  text-align: center;
  line-height: 1.4;
}
</style>